/**
 * 智慧小区管理系统 - 投诉建议模块类型定义
 * @author Wu.Liang
 * @date 2025-06-26
 * @version 3.0 - 根据系统设计调整方案重构，独立投诉建议模块
 */

// 基础查询参数 - 根据新接口调整
export interface BaseQueryParams {
  current?: number
  size?: number
  keyword?: string | undefined
  startDate?: string | undefined
  endDate?: string | undefined
  orderBy?: string | undefined
  orderDirection?: string | undefined
}

// 投诉建议查询参数 - 根据新接口调整
export interface ComplaintQueryParams extends BaseQueryParams {
  communityId?: number | undefined
  userId?: number | undefined
  categoryId?: number | undefined
  status?: number | undefined
  priority?: number | undefined
  assigneeId?: number | undefined
}

// 投诉建议状态枚举 - 根据新接口调整
export enum ComplaintStatus {
  PENDING = 1,    // 待受理
  PROCESSING = 2, // 已受理
  IN_PROGRESS = 3, // 处理中
  RESOLVED = 4,   // 已完成
  CLOSED = 5      // 已关闭
}

// 投诉建议优先级枚举 - 根据新接口调整
export enum ComplaintPriority {
  LOW = 1,      // 低
  NORMAL = 2,   // 中等
  HIGH = 3,     // 高
  URGENT = 4    // 紧急
}

// 投诉建议分类 - 保持兼容
export interface ComplaintCategory {
  id: number
  name: string
  description?: string
  icon?: string
  color?: string
  sortOrder: number
  isEnabled: boolean
  createTime: string
  updateTime: string
}

// 投诉建议主表 - 根据新接口调整
export interface Complaint {
  id: number
  orderNo: string
  userId: number
  communityId: number
  categoryId: number
  title: string
  content: string
  status: number
  priority: number
  assigneeId?: number
  assignTime?: string
  resolveTime?: string
  satisfaction?: number
  createTime: string
  updateTime: string
  // 关联信息
  userName?: string
  communityName?: string
  categoryName?: string
  assigneeName?: string
  statusName?: string
  priorityName?: string
}

// 投诉处理流程 - 保持兼容
export interface ComplaintProcess {
  id: number
  complaintId: number
  operatorId: number
  operatorName: string
  action: string
  actionName: string
  content: string
  status: number
  statusName: string
  createTime: string
  remark?: string
}

// 投诉回访记录 - 保持兼容
export interface ComplaintFollowup {
  id: number
  complaintId: number
  followupType: number
  followupTypeName: string
  content: string
  satisfaction: number
  operatorId: number
  operatorName: string
  createTime: string
  nextFollowupTime?: string
}

// 投诉统计分析 - 根据新接口调整
export interface ComplaintStatistics {
  totalCount: number
  pendingCount: number
  processingCount: number
  resolvedCount: number
  closedCount: number
  avgResolveTime: number
  satisfactionRate: number
  categoryStats: Array<{
    categoryId: number
    categoryName: string
    count: number
    percentage: number
  }>
  monthlyStats: Array<{
    month: string
    count: number
    resolvedCount: number
  }>
}

// 投诉知识库 - 保持兼容
export interface ComplaintKnowledge {
  id: number
  title: string
  content: string
  categoryId: number
  categoryName: string
  tags?: string[]
  viewCount: number
  isEnabled: boolean
  createTime: string
  updateTime: string
}

// 创建投诉建议参数 - 根据新接口调整
export interface CreateComplaintParams {
  userId: number
  communityId: number
  categoryId: number
  title: string
  content: string
  priority: number
  remark?: string
}

// 更新投诉建议参数 - 根据新接口调整
export interface UpdateComplaintParams {
  title?: string
  content?: string
  categoryId?: number
  priority?: number
  status?: number
  assigneeId?: number
  remark?: string
}

// 分配投诉建议参数 - 根据新接口调整
export interface AssignComplaintParams {
  assigneeId: number
  remark?: string
}

// 处理投诉建议参数 - 根据新接口调整
export interface ProcessComplaintParams {
  status: number
  content: string
  remark?: string
}

// 回访投诉建议参数 - 保持兼容
export interface FollowupComplaintParams {
  followupType: number
  content: string
  satisfaction: number
  nextFollowupTime?: string
}

// 满意度评价参数 - 根据新接口调整
export interface SatisfactionParams {
  satisfaction: number
  comment?: string
}

// 批量操作参数 - 根据新接口调整
export interface BatchComplaintParams {
  complaintIds: number[]
  action: string
  assigneeId?: number
  status?: number
  remark?: string
}

// 基础响应类型 - 保持兼容
export interface ApiResponse<T = unknown> {
  code: number
  message: string
  data: T
  success?: boolean
}

// 分页响应类型 - 保持兼容
export interface PageResponse<T = any> {
  records: T[]
  total: number
  size: number
  current: number
  pages: number
} 